package com.itheima.web.controller;


import com.itheima.domain.vo.AnalysisSummaryVo;
import com.itheima.domain.vo.AnalysisUserVo;
import com.itheima.web.manager.AnalysisManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AnalysisController {

    @Autowired
    private AnalysisManager analysisManager;

    /**
     * 查询首页概要统计
     * @return
     */
    @GetMapping("/dashboard/summary")
    public AnalysisSummaryVo summary(){
        return analysisManager.summary();
    }

    //统计图
    @GetMapping("/dashboard/users")
    public AnalysisUserVo users(
            @RequestParam(name = "sd")String start,
            @RequestParam(name = "ed")String end,
            String type
    ) {
        return analysisManager.users(start, end, type);
    }
}
